<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="../defaultTemplate.xhtml">
	<ui:define name="content">
		<p:accordionPanel>
			<p:tab title="Simple BPP">
				<h:panelGrid columns="4">
					<f:facet name="caption">
						<h:outputLabel value="Simple BPP" />
					</f:facet>
					<h:outputLabel value="Nombre: " for="idName" />
					<h:inputText id="idName" value="#{ajaxBean.engineName}" />
					<p:commandButton value="Enviar" update="displayName" />
					<p:ajaxStatus style="width:16px;height:16px;">
						<f:facet name="start">
							<h:graphicImage value="../desing/ajaxloading.gif" />
						</f:facet>
						<f:facet name="complete">
							<h:outputText value="" />
						</f:facet>
					</p:ajaxStatus>
				</h:panelGrid>
				<h:outputText value="#{ajaxBean.engineName}" id="displayName" />
			</p:tab>

			<p:tab title="Count">
				<h:panelGrid columns="2">
					<h:outputLabel value="Consecutivo: " for="idCount" />
					<h:outputText value="#{ajaxBean.engineCount}" id="idCount" />
					<p:commandButton value="Continuar"
						actionListener="#{ajaxBean.countListener}" update="idCount" />
					<p:ajaxStatus style="width:16px;height:16px;">
						<f:facet name="start">
							<h:graphicImage value="../desing/ajaxloading.gif" />
						</f:facet>
						<f:facet name="complete">
							<h:outputLabel value="" />
						</f:facet>
					</p:ajaxStatus>
				</h:panelGrid>
			</p:tab>

			<p:tab title="Data Table">
				<p:panel header="Nuevo Libro">
					<h:panelGrid columns="2">
						<h:outputLabel value="Titulo" for="idTitulo" />
						<h:inputText id="idTitulo" value="#{ajaxBean.book.titulo}" />
						<h:outputLabel value="Autor" for="idAutor" />
						<h:inputText id="idAutor" value="#{ajaxBean.book.autor}" />

						<p:commandButton value="Agregar"
							actionListener="#{ajaxBean.addLibroListener}"
							update="tableBook idTitulo" />
						<p:ajaxStatus>
							<f:facet name="start">
								<h:graphicImage value="../desing/ajaxloading.gif" />
							</f:facet>
							<f:facet name="complete">
								<h:outputText />
							</f:facet>
						</p:ajaxStatus>
					</h:panelGrid>
				</p:panel>

				<p:dataTable id="tableBook" value="#{ajaxBean.books}" var="book"
					style="width:400px;" paginator="true" rows="2"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="10,15">
					<p:column headerText="Titulo" footerText="Resumen"
						sortBy="#{book.titulo}">
						<h:outputLabel value="#{book.titulo}" />
					</p:column>
					<p:column headerText="Autor">
						<h:outputLabel value="#{book.autor}" />
					</p:column>
					<p:column headerText="Opciones">
						<p:commandButton value="Eliminar" title="Eliminar"
							image="../desing/ajaxloading.gif" update="tableBook" actionListener="#{ajaxBean.removeBookListener}">
							<f:setPropertyActionListener target="#{ajaxBean.bookSelected}" value="#{book}" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</p:tab>
		</p:accordionPanel>
	</ui:define>
</ui:composition>
</html>